package digui;

public class PowersOfn {
    public static void main(String[] args) {
        System.out.println(power(2, 4));
    }
    public static int power(int p, int n) {
        int mid = n >> 1;
        if (mid == 0){
            return p;
        }
        int first = power(p, mid);
        if(n % 2 == 0){
            return first * first;
        }else{
            return p * first * first;
        }
    }
}
